package edu.umd.ion.wavemeter.client;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.VerticalPanel;

public class CalibrationConfirmationDialog extends DialogBox {
	ClickHandler DoCalibration;
	
	 public CalibrationConfirmationDialog(ClickHandler doCalibration) {
		  DoCalibration = doCalibration;	
	      // Set the dialog box's caption.
	      setText("Calibration Confirmation");
	      setStylePrimaryName("wm-DialogBox");

	      // DialogBox is a SimplePanel, so you have to set its widget property to
	      // whatever you want its contents to be.
	      Button ok = new Button("Calibrate");
	      ok.addClickHandler(new ClickHandler() {
	        public void onClick(ClickEvent event) {
	        	CalibrationConfirmationDialog.this.hide();
	        	DoCalibration.onClick(event);
	        }
	      });
	      Button cancel = new Button("Cancel");
	      cancel.addClickHandler(new ClickHandler() {
	        public void onClick(ClickEvent event) {
	        	CalibrationConfirmationDialog.this.hide();
	        }
	      });

	      HorizontalPanel Buttons = new HorizontalPanel();
	      Buttons.add(cancel);
	      Buttons.add(ok);
	      
	      VerticalPanel Panel = new VerticalPanel();
	      Panel.add(new HTML("You are asking for a recalibration of the Wavemeter, are you absolutely sure you want to do that? Remember, there is no undo button!"));
	      Panel.add(Buttons);
	      setWidget(Panel);
	    }
}		

